<?php
class Form_Template extends Zend_Form
{
    public function __construct($options=array())
    {
		parent::__construct($options);
		//print_r($options); exit;
		$this->setMethod('post');
		$this->addPrefixPath('Lion_Form_Element', '../library/Form/Element/', 'element');
		
		$this->addElement('text', 'module_name', array(
            'label'      => 'Module:',
            'filters'    => array('StringTrim'),
            'class'			 => 'input-2',
            'validators' => array(
            	array('validator' => 'StringLength', 'options' => array(0, 100))
            )
        ));
        
        $this->addElement('text', 'template_title', array(
            'label'      => 'Template Title:',
            'filters'    => array('StringTrim'),
            'class'			 => 'input-2',
            'validators' => array(
            	array('validator' => 'StringLength', 'options' => array(0, 100))
            )
        ));
        
		
        $template_content = $this ->addElement('formRTE', 'template_content',
    				array('label' =>'Template content:', 
    					'validators' =>array(
    					array('validator' =>'StringLength', 'options' =>array(0, 1000))
    				),    				
		));
		
		//$template_content->addDecorator('HtmlTag', array('tag'=>'div', 'class'=>'form-sect-2','placement'=>'append'));
		
		if(!empty($options))
		{
			if($options['action'] == "edit")
			{ 
	    	   	$this->addElement('hidden', 'template_id', array(	            
	    	            'filters'  => array('int'),
	    	            'class'	   => 'hidden',
	    	            'value'    => $options['template_id'],	            
	    	    ));
			}
		}
		//$this->addElement('submit', $btn_label);
    }
}
